<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>Netty+WebSocket+SSM演示</title>
</head>
<body>
	<div>
		<input type="button" value="Start" onclick="start()" />
	</div>
	<div id="messages"></div>
	<script type="text/javascript">
		var webSocket = new WebSocket('ws://localhost/nettyDemo/websocket');
		webSocket.onerror = function(event) {
			alert(event.data);
		};
		//与WebSocket建立连接
		webSocket.onopen = function(event) {
			document.getElementById('messages').innerHTML = '与服务器端建立连接';
		};
		//处理服务器返回的信息
		webSocket.onmessage = function(event) {
			document.getElementById('messages').innerHTML += '<br />'+ event.data;
		};
		function start() {
			//向服务器发送请求
			/* webSocket.send('我是jCuckoo'); */
		}
	</script>
</body>
</html>